from typing import Optional

from pydantic import BaseModel,Field

from enum import Enum
class VoiceTTSRequest(BaseModel):
    text: str = Field(..., description="文本内容")
    file_name: Optional[str] = Field("voice", description="文件名")
    sample_rate: Optional[int] = Field(16000, description="采样率")
    format: Optional[str] = Field("wav", description="音频格式")
    voice: Optional[str] = Field("zhixiaoxia", description="音色")
    speech_rate: Optional[int] = Field(50, description="语速")
    pitch_rate: Optional[int] = Field(0, description="音调")
    volume: Optional[int] = Field(50, description="音量")
class CallStatus(str, Enum):
    DIALING = "dialing"
    CONNECTED = "connected"
    COMPLETED = "completed"
    FAILED = "failed"
class TalkStatusRequest(BaseModel):
    """
    通话状态
    """
    status: CallStatus = Field(..., description="状态")
    phone: Optional[str] = Field("", description="电话")
    device_phone: str = Field(..., description="设备电话")
    task_id: int = Field(..., description="任务ID")
    customer_id: str = Field(..., description="客户ID")

class VoiceDetectRequest(BaseModel):
    """
    语音检测请求
    """
    # audio_data: str = Field(..., description="音频数据(base64编码)")
    # sample_rate: Optional[int] = Field(16000, description="采样率")
    # format: Optional[str] = Field("wav", description="音频格式")
    device_phone: str = Field(..., description="设备电话")
